{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def TEIndicatorCharts(dataFrame, country, indicator):\n",
    "   \n",
    "    dataFrame = dataFrame.loc[dataFrame['Category'] == indicator[0]]\n",
    "    dataFrame['DateTime'] = pd.to_datetime(dataFrame['DateTime'])\n",
    "    myReducedDF = dataFrame.pivot(index = 'DateTime', columns= 'Country', values='Value')\n",
    "    startDate = myReducedDF.tail(1).index[0] - relativedelta(years=5)\n",
    "    myReducedDF = myReducedDF.loc[startDate:]\n",
    "    del myReducedDF.index.name \n",
    "    del myReducedDF.columns.name\n",
    "    myReducedDF = myReducedDF.interpolate(method='cubic')\n",
    "\n",
    "    r = math.ceil(len(country)/2.) \n",
    "    plt.figure(1, figsize=(15, 5*r))\n",
    "    pos = \"{r}21\".format(r = int(r))\n",
    "    pos = int(pos)\n",
    "    for par in country:\n",
    "        host = host_subplot(pos, axes_class=AA.Axes)\n",
    "        pos = pos+1\n",
    "        par1 = host.twinx()\n",
    "        s1mask = np.isfinite(myReducedDF[par[0]])\n",
    "        host.plot(myReducedDF[par[0]][s1mask]) \n",
    "        s2mask = np.isfinite(myReducedDF[par[1]])\n",
    "        par1.plot(myReducedDF[par[1]][s2mask]) \n",
    "        plt.legend()\n",
    "        plt.title(indicator[0])\n",
    "        host.set_ylabel(par[0])\n",
    "        par1.set_ylabel(par[1])\n",
    "        plt.subplots_adjust(bottom=.1, right = 1.2)   \n",
    "    plt.show()\n",
    "\n",
    "    return"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
